<?php $this->load->view(TEMPLATE_NAME.'/admin/header');?>
<?php $this->load->view(TEMPLATE_NAME.'/admin/side_left');?>
<script type="text/javascript" src="<?php echo base_url()?>js/jquery-1.4.2.js"></script>
<script type="text/javascript">
function update(services_id, services_name, type){
    $('#services_id').val(services_id);
    $('#services_name').val(services_name);  
    $('#types option[value="'+type+'"]').attr('selected','selected');  
}
function confirmation(category, name, id) {
    var answer = confirm("Delete " + category + " " + name +" ?");
    if (answer){   
        location = '<?php echo site_url("admin/design_directory/services/category")?>/' + category + '/id/' + id;
    }else{
        return false;
    }
}  
</script>
<div class="page noright adminpage">
<h5 class="purple">The Mykprisguide Print - Design Directory</h5>
<hr />
<?php $this->load->view(TEMPLATE_NAME.'/admin/directory/directory_admin_header');?>
<hr /> 
<h3 class="purple">
<?php
switch($category){
    case 'products' : echo 'Product';break;
    case 'services' : echo 'Service';break;
    case 'brands' : echo 'Brand';break;
} 
?> List</h3>
<hr />
<table class="tableadmin">
<?php if(!empty($list_services)){ 
	$count = 0;
	$count_web = 0;
    foreach($list_services as $services){
		if($services['service_type'] == 'print')
		{
			
			
?>
<?php if($count == 0){?><tr><td colspan="4">print design</td></tr><?php }$count++;?>
<tr><td width="60%"><?php echo $services['name']?></td>
<td width="10%"><?php echo $services['service_type']?></td>
<td class="purple"><?php if(!empty($services['jumlah'])){echo $services['jumlah'];}else{ echo 0;}?> listings</td>
<td class="delete_right">
<a style="cursor:pointer;" onclick="confirmation('<?php echo $category ?>', '<?php echo $services['name'] ?>','<?php echo $services['id'] ?>')">delete</a> | 
<a style="cursor:pointer;" onclick="update('<?php echo $services['id']?>','<?php echo $services['name']?>','<?php echo $services['service_type']?>')" >edit</a></td>
</tr>
<?php }else{?>
<?php if($count_web == 0){?><tr><td colspan="4"><br />web design</td></tr><?php }$count_web++;?>
<tr>

<td width="60%"><?php echo $services['name']?></td>
<td width="10%"><?php echo $services['service_type']?></td>
<td class="purple"><?php if(!empty($services['jumlah'])){echo $services['jumlah'];}else{ echo 0;}?> listings</td>
<td class="delete_right">
<a style="cursor:pointer;" onclick="confirmation('<?php echo $category ?>', '<?php echo $services['name'] ?>','<?php echo $services['id'] ?>')">delete</a> | 
<a style="cursor:pointer;" onclick="update('<?php echo $services['id']?>','<?php echo $services['name']?>','<?php echo $services['service_type']?>')" >edit</a></td>
</tr>
	
<?php }?>
<?php }// end foreach 
}else{ // end if ?>
<tr><td colspan="3">No data</td></tr>
<?php } ?>
</table>
<?php
$action = 'admin/design_directory/services/category/'.$category; 
echo form_open($action);
?>
<div class="forml"><p class="f14">Services Type:</p></div>
<div class="formr"><p><select name="types" id="types"><option value="print">Print design</option><option value="web">Web design</option></select></p></div>
<div class="clear"></div>
<div class="forml"><p class="f14">Add/Edit:</p></div><!-- forml -->
<div class="formr">
<?php 
$input_data = array(
    'name'        => 'services_name',
    'id'          => 'services_name',
    'class'       => 'mid',
    //'value'       => 'johndoe',
    //'maxlength'   => '100',
    //'size'        => '50',
    //'style'       => 'width:50%',
);
echo form_input($input_data);
?>
</div><!-- formr -->
<div class="clear"></div>
<hr />
<div class="forml">&nbsp;</div><!-- forml -->
<div class="formr">
<?php
$form_button = array(
    'type'=>'submit',
    'name'=>'submit',
    'value'=>'submit',
    'content'=>'Submit',
);
echo form_button($form_button);
?>
<input type="hidden" name="services_id" id="services_id">
<?php echo form_close();?>
</div><!-- formr -->
<div class="clear"></div>
<hr />  
</div><!-- page -->
<?php $this->load->view(TEMPLATE_NAME.'/admin/footer');?>